<?php
	class ThemeManager {
		static function GetResourcesFrom($theme, $what) {
			$ret = array();
			
			if (WISPConf::ThemeExists($theme)) {
				$path	 = WISPConf::LookupPath('fs/theme',array("theme" => $theme));
				$webpath = WISPConf::LookupPath('web/theme',array("theme" => $theme));
				
				$items = scandir("$path/$what");
				foreach ($items as $item) {
					if ($item[0] == '.') continue;
					
					$ret[] = "$webpath/$what/$item";
				}
			}
			else throw new Exception("Theme not found: $theme");
			
			return $ret;
		}
		static function GetStylesheetsFor($theme) {	
			return self::GetResourcesFrom($theme,"css");
		}
		static function GetScriptsFor($theme) {
			return self::GetResourcesFrom($theme,"js");
		}
	}
?>